import { BroadCastCall } from "../../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../../Framework/MQ/MessageBlock";
import { SEntityId } from "../../../../../Message/Public/SEntityId";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { Cache } from "../../../cache/Cache";
import { MsgManager } from "../../../manager/MsgManager";
import { Language } from "../../../../../extend/language/Language";
import { NetDispatcher } from "../../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../../mvc/ServerCommand";
//class CopyModifyGroupCaptainCommand
    
    export  class CopyModifyGroupCaptainCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            super.call(arg1);
            var loc1=arg1.messageBase as SEntityId;
            if (_cache.copy.groupInfo) 
            {
                _cache.copy.groupInfo.captainId = loc1;
            }
            else 
            {
                return;
            }
            if (EntityUtil.toString(loc1) == EntityUtil.toString(Cache.instance.role.entityInfo.entityId)) 
            {
                MsgManager.showRollTipsMsg(Language.getString(62027));
            }
            NetDispatcher.dispatchCmd(ServerCommand.Copy_CaptainChange, _cache.copy.groupInfo.captainId);
            return;
        }
    }
